package org.dong.control;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@RestController
public class HrefControl {

    @GetMapping("/")
    public  ModelAndView index(){

        return new ModelAndView("login");
    }

    @GetMapping("/href")
    public ModelAndView href(HttpServletRequest req){

        String path = req.getParameter("to");

        if(path != null){

            return new ModelAndView(path);
        }else{
            return new ModelAndView("login");
        }
    }

}
